import openpyxl
def read_excel(file_path):
    workbook = openpyxl.load_workbook(file_path)
    sheet = workbook.active
    data = []
    for row in sheet.iter_rows(min_row=2, values_only=True):
        data.append(row)
    return data


data = read_excel('武汉市主要湖泊信息.xlsx')
s = []
fishs = []
for row in data:
    lake = {
        "name": row[1],
        "area": row[2],
        "location": row[3],
        "path": row[4].split(','),
        "content": row[5],
        "fish": row[6].split(',')
    }
    s.append(lake)
    for i in row[6].split(','):
        fishs.append(i)
with open('lakes.json', 'w', encoding='utf-8') as f:
    f.writelines(str(s))
fishs = list(set(fishs))
ls = []
for i in fishs:
    ls.append({'value': f'{i}', 'label': f'{i}'})
ls.append({'value': f'其他', 'label': f'其他'})
with open('fishs.json', 'w', encoding='utf-8') as f:
    f.writelines(str(ls))